package tests_unitaires;

import doc.DocumentText;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class DocumentTest extends TestCase {

	public DocumentTest(String arg0) {
		super(arg0);
	}
	
	public static Test suite() {
		return new TestSuite(DocumentTest.class);
	}

	public void testCount() {
		DocumentText document = new DocumentText("Hello world. \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n test test"); //20 lignes, deux page
		assertTrue(document.nombreDePages == 2);
		
		document = new DocumentText("Hello world. \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n test test"); // 19 lignes, une page
		assertTrue(document.nombreDePages == 1);
		
		document = new DocumentText("J'aime bien les patates."); 
		assertTrue(document.nombreDeMots == 5);
		
		document = new DocumentText("abcdefghijklmnopqrstuvwxyz"); 
		assertTrue(document.nombreDeCaracteresTotal == 26);
		
		document = new DocumentText("MUDKIPS \r\n\r\n ARE \r\n\r\n AMAZING"); // sur PC seulement
		assertTrue(document.nombreDeParagraphes == 3);
	}
}
